package cn.edu.scau.cmi.yanghaorui.client;

import java.io.File;
import java.net.URL;

//import cn.edu.scau.cmi.yanghaorui.adapter.ClassAdapter;
import cn.edu.scau.cmi.yanghaorui.adapterFxml.MyController;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

public class AdapterClient extends Application{

	@Override
	public void start(Stage primaryStage) {
		try {
			
			primaryStage.setTitle("第四次实验");
			FXMLLoader fx=new FXMLLoader();
			URL url=fx.getClassLoader().getResource("cn/edu/scau/cmi/yanghaorui/adapterFxml/Adapter.fxml");
			System.out.println(new File("cn/edu/scau/cmi/yanghaorui/client/adapter/Adapter.fxml").getCanonicalPath());
			//System.out.println(fx.getClassLoader().getResource("/cn/edu/scau/cmi/yanghaorui/adapter/Adapter.fxml"));
			fx.setLocation(url);
			//System.out.println("6666");
			AnchorPane root1=(AnchorPane)fx.load();//代码执行到这里停止
			
			
			MyController mc=(MyController)fx.getController();
			Button bu=mc.getButton();
			//bu.setOnAction(value);
			/*bu.setOnAction(new EventHandler<ActionEvent>() 
			{
				@Override
				public void handle(ActionEvent event){
				System.out.println("6");
				}	
			};)*/
			//System.out.println(mc.getFxmllabel().getText());	
			Scene scene = new Scene(root1);
			primaryStage.setScene(scene);
			primaryStage.show();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	
	public static void main(String[] args) {
		launch(args);
	}
}



